<template>
  <lay-layer v-model="visible" :shade="true" :shadeClose="false" shadeOpacity="0.2"
             :area="['320px', '428px']" :success="init" :btn="action" btnAlign="c" :close="closeParentTimer">
    <div style="padding: 20px">
      <lay-qrcode :text="formRef.qrcodeUrl"></lay-qrcode>
    </div>
  </lay-layer>
</template>
<script setup lang="ts">
import {ref} from 'vue'
import useFxwForm from "@/hooks/useFxwForm";

const emit = defineEmits(['closeParentTimer'])
const {changeVisible,visible} = useFxwForm()
const props = defineProps({
  qrcodeUrl: {
    type: String,
    default: ''
  }
});

const formRef = ref({
  qrcodeUrl: ''
});

const init = function () {
  formRef.value.qrcodeUrl = props.qrcodeUrl
};

const action = ref([
  {
    text: "关闭",
    callback: () => {
      closeParentTimer()
      changeVisible();
    }
  }
])

const closeParentTimer = function () {
  emit('closeParentTimer')
};

defineExpose({
  changeVisible
})



</script>

<style scoped>


</style>